<template>
	<view>
		<u-sticky offset-top="0">
			<view class="search-bar">
				<u-search placeholder="输入城市名称查询" v-model="search" :clearabled="true" :show-action='false' height="56" @change="onChange"
				 width="706" style="width: 702rpx; height: 66rpx;"></u-search>
			</view>
		</u-sticky>
		<view v-show="isShow" scroll-y='true'>
			<view v-for="(item,index) in a" :key='item.id' class="searchList">
				<view @click="onCity(item)">{{item.name}}</view>
			</view>
			<view style="font-size: 30rpx; color: rgb(120,120,120);text-align: center;" v-show="a.length===0">
				-----暂无地址-----
			</view>
		</view>
		<view v-show="search===''">
			<view class="header">
				<view class="dw">
					<view>定位城市</view>
					<view v-if="city===null" @click="addrestype(city,false)">定位失败</view>
					<view v-else @click="addrestype({name:city,province:province},true)">{{ city }}</view>
				</view>
				<view>
					<view class="all">全部城市</view>
				</view>
			</view>
			
			<page-loading :show='pageLoading'>
				<view class="city" @click="onBlur">
					<u-index-list active-color="#FBB000" :sticky="false" :index-list="indexList" :scrollTop="scrollTop">
						<view v-for="(item, index) in cityList" :key="item.letter">
							<u-index-anchor :index="item.letter" />
							<view>
								<view class="list-cell" v-for="(item1, index1) in item.data" :key="item1.id" @tap="addrestype(item1,true)">
									<text>{{item1.name}}</text>
								</view>
							</view>
						</view>
					</u-index-list>
				</view>
			</page-loading>
		</view>
	</view>

	</view>
</template>


<script src="./address.js"></script>

<style lang="scss" scoped>
	@import './address.scss';
</style>
